﻿using System;
using System.ComponentModel;
using System.Data;
using System.Windows;
using WPFExcelReport.Helpers;
using ReflectionStudio.Core.Events;
namespace WPFExcelReport
{
    public partial class UIGBMOV : ViewBase
    {
        public UIGBMOV()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
        }

        public override void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            if (IsLoaded)
                return;
            base.Window_Loaded(sender, e);
        }

        public override void vwMaster_CurrentChanged(object sender, System.EventArgs e)
        {
            base.vwMaster_CurrentChanged(sender, e);
            
        }
        public virtual void Insert(DataRow _dwVVA)
        {
            //((VICC_GBMOV)MV).InsertVVAVIS(_dwVVA, app.company);
            TBMain.Rows.InsertAt(_dwVVA, 0);
            vwMaster.View.MoveCurrentToFirst();

        }
        
        public virtual void OnPARTIEChg(string value)
        { 
        }
    }
    /// <summary>
    /// 这个地方定义了公共变量
    /// </summary>
    public partial class UIGBMOV : ViewBase
    {
        #region ==dwGB===========
        public static readonly DependencyProperty dwGBProperty = DependencyProperty.Register("dwGB",
            typeof(DataRow), typeof(UIGBMOV),
            new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OndwGBChanged));
        public DataRow dwGB
        {
            get
            {
                return (DataRow)GetValue(dwGBProperty);
            }
            set
            {
                SetValue(dwGBProperty, value);
            }
        }
        private static void OndwGBChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIGBMOV;
            if (src != null)
            {
                src.dwGB = (DataRow)e.NewValue;
            }
        }
        #endregion 
        #region ==FROMDATE===========
        public static readonly DependencyProperty FROMDATEProperty = DependencyProperty.Register("FROMDATE",
            typeof(string), typeof(UIGBMOV),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnFROMDATEChanged));
        public string FROMDATE
        {
            get
            {
                return (string)GetValue(FROMDATEProperty);
            }
            set
            {
                SetValue(FROMDATEProperty, value);
            }
        }
        private static void OnFROMDATEChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIGBMOV;
            if (src != null)
            {
                src.FROMDATE = (string)e.NewValue;
            }
        }
        #endregion
        
        #region ==ENDDATE===========
        public static readonly DependencyProperty ENDDATEProperty = DependencyProperty.Register("ENDDATE",
            typeof(string), typeof(UIGBMOV),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnENDDATEChanged));
        public string ENDDATE
        {
            get
            {
                return (string)GetValue(ENDDATEProperty);
            }
            set
            {
                SetValue(ENDDATEProperty, value);
            }
        }
        private static void OnENDDATEChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIGBMOV;
            if (src != null)
            {
                src.ENDDATE = (string)e.NewValue;
            }
        }
        #endregion

        #region ==DAT===========
        public static readonly DependencyProperty DATProperty = DependencyProperty.Register("DAT",
            typeof(string), typeof(UIGBMOV),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnDATChanged));
        public string DAT
        {
            get
            {
                return (string)GetValue(DATProperty);
            }
            set
            {
                SetValue(DATProperty, value);
            }
        }
        private static void OnDATChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIGBMOV;
            if (src != null)
            {
                src.DAT = (string)e.NewValue;
            }
        }
        #endregion

        #region ==PARTIE===========
        public static readonly DependencyProperty PARTIEProperty = DependencyProperty.Register("PARTIE",
            typeof(string), typeof(UIGBMOV),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnPARTIEChanged));
        public string PARTIE
        {
            get
            {
                return (string)GetValue(PARTIEProperty);
            }
            set
            {
                SetValue(PARTIEProperty, value);
                OnPARTIEChg(value);
            }
        }
        private static void OnPARTIEChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIGBMOV;
            if (src != null)
            {
                src.PARTIE = (string)e.NewValue;
            }
        }
        #endregion
    }
}